import sys
import torch
from torchvision import transforms
from PIL import Image
import numpy as np

print(torch.cuda.is_available())
print(torch.version.cuda)
print("anaconda.........")
print(sys.path)

img = Image.open("1.png")

ts = transforms.Compose(
    transforms=[transforms.CenterCrop(size=(200, 100)),  # 基于中心点进行图像的剪切
                transforms.ToTensor()  # PIL转换为tensor
                ]
)
ts2 = transforms.Compose(
    transforms=[
        # ts,
        transforms.ToPILImage()  # PIL转换为tensor
    ]
)

tensor = ts(img)
print(tensor.size())
img2: Image.Image = ts2(tensor)
